import java.util.Arrays;

public class TestDemo {
    public static void main(String[] args) {
        int[] array = {1,2,2,2,2,1};
        System.out.println(func(array));
    }

    public static int func(int[] array) {
        Arrays.sort(array);
        return array[array.length/2];
    }
}
